#ifndef __MainCharacter_h_
#define __MainCharacter_h_

#include "Character.h"
#include "MovableItem.h"

class Enemy;
class Bullet;
class Weapon;

class MainCharacter : public Character, public MovableItem, public Ogre::FrameListener, public Ogre::Singleton<MainCharacter>
{

	friend class GameManager;

	// Attributes ------------------------------------------------------------------------------

public:
	enum Model{TUX,TUXY};

protected:
	int lives;
	int fish;
	int score;
	bool shield;
	bool shieldTouched;
	Weapon* currentWeapon;
	unsigned int tchouSoundId;
	unsigned int shieldSoundId;
	unsigned int outchSoundId;
	std::vector<Bullet*> bullets;
	Ogre::Real mTimeUntilNextToggle;
	Ogre::Real mTimeUntilShieldEnd;
	Ogre::Real mTimeUntilShield;
	Ogre::Real mTimeUntilnextVisibility;
	Ogre::ParticleSystem* pSys2;
	Ogre::SceneNode* fNode;
	Ogre::ParticleSystem* pSysParticleTuxRight;
	Ogre::SceneNode* fNodeParticleTuxRight;
	Ogre::ParticleSystem* pSysParticleTuxLeft;
	Ogre::SceneNode* fNodeParticleTuxLeft;
	Ogre::AnimationState* mAnimState;
	Ogre::SceneNode* persoNode;

	static int ID;
	static const char* DEFAULT_NAME;

	// Methods ---------------------------------------------------------------------------------
protected:
	MainCharacter();
	virtual void initialize();

public:
	bool processUnbufferedKeyInput(const Ogre::FrameEvent& evt);
	virtual bool move();
	virtual void collision(Item* _item);
	virtual void collisionWithBullet(Bullet* _bullet);
	virtual void collisionWithEnemy(Enemy* _enemy);
	virtual void collisionWithMainCharacter(MainCharacter* _mainCharacter);
	virtual void collisionWithFish(Fish * _fish);
	virtual void collisionWithBonus(Bonus* _bonus);
	virtual void collisionWithWeapon(Weapon* weapon);
	bool frameStarted(const Ogre::FrameEvent& evt);
	int getLives();
	void liveLost();
	int getFish();
	void fishWon();
	int getScore();
	void addScore(int points);
	bool getShield();
	void setShield(bool b);
	void clignotement(const Ogre::FrameEvent& evt);
	void bouclier(const Ogre::FrameEvent& evt);

	void setModel(Model);

};

#endif